public class test10 {
    public static void main(String[] args) {
        Node a = new Node(1);
        Node b = new Node(2);
        Node c = new Node(3);
        Node d = new Node(4);
        Node e = new Node(5);
        Node f = new Node(6);

        a.next = b;
        b.next = c;
        c.next = d;
        d.next = e;
        e.next = f;

        Node result = getList(a);
        System.out.println(result.val);
    }

    public static  Node getList(Node head){
        if (head == null||head.next == null)
            return head;

        // 合并链表(有序)
        Node cur = head.next;
        head.next = null;

        while (cur != null){
            Node curNext = cur.next;
            cur.next = head;
            head = cur;
            cur = curNext;
        }
        return head;
    }
}
